package com.ph.shopping.facade.profit.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.ph.shopping.common.core.base.BaseService;
import com.ph.shopping.common.util.result.Result;
import com.ph.shopping.facade.profit.service.IProfitService;
@Component
public class UserWithdrawalsScheduler extends BaseService {
	@Autowired
	private IProfitService iProfitService;

	@Scheduled(cron = "0 */1 * * * ?")
	public void doProfit() {
		logger.debug("提现入分润表每隔1分钟执行一次---------->开始");
		try {
			System.out.println("商户提现的入分润表");
			Result result = iProfitService.executiveMerchantWithdrawalsIntoUnlineSupplychainProfit();
			System.out.println("代理商提现的入分润表");
			iProfitService.executiveAgentWithdrawalsIntoUnlineSupplychainProfit();
			if(result.getCode()=="200"){
				logger.info("商户或者代理提现入分润表成功");
			}
		} catch (Exception e) {
			logger.error("商户或者代理提现入分润表失败");
			e.printStackTrace();
		}
	}
}
